$(document).ready(function() {
  $("#myForm").submit(function(event) {
    event.preventDefault(); // 阻止默认的表单提交行为

    var TaskNo = $("#TaskNo").val(); // 获取输入框的值
    var TaskType = $("#TaskType").val(); // 获取输入框的值
    var Priority = $("#Priority").val(); // 获取输入框的值
    var VehicleNo = $("#VehicleNo").val(); // 获取输入框的值
    var VehicleType = $("#VehicleType").val(); // 获取输入框的值
    var FinishAction = $("#FinishAction").val(); // 获取输入框的值
    var FPCarryState =$("#FPCarryState").val();
    var Pickup_point = $("#Pickup_point").val();
    var Unloading_point = $("#Unloading_point").val();
    var Discharge_height =$("#Discharge_height").val();

    var data = { "TaskNo": TaskNo,"TaskType":TaskType,
    "Priority":Priority,
    "VehicleNo" :VehicleNo,
    "VehicleType": VehicleType,
    "FinishAction":FinishAction,
     "FPCarryState": FPCarryState,
     "Pickup_point":Pickup_point,
     "Unloading_point":Unloading_point,
     "Discharge_height":Discharge_height
     };
    var param =JSON.stringify(data);
    $.ajax({
      type: "POST", // 指定请求类型为 POST
      url: "http://localhost:9090/saveTask", // 设置请求的 URL
      dataType: "json",
      contentType : "application/json;charset=UTF-8",
      data: param, // 将输入框的值作为参数传递
      success: function(response) {
        // 处理请求成功的逻辑
        console.log(response);
      },
      error: function(xhr, status, error) {
        // 处理请求失败的逻辑
        console.error(xhr, status, error);
      }
    });

  });
});